Skip to content

[6.x] Name untitled drafts in workflow notifications - #20465

Open
brandonkelly wants to merge 1 commit into
6.xfrom
bugfix/workflow-notification-untitled-entry
Open

brandonkelly wants to merge 1 commit into
6.xfrom
bugfix/workflow-notification-untitled-entry

Conversation

@brandonkelly

Copy link
Copy Markdown
Member

Description

Workflow notifications named the entry with $draft->title, which is empty when a draft has no title yet. A new entry can be saved as a draft and submitted for review without one, because draft saves use the essentials scenario. Reviewers then got “” is awaiting your approval in Review. Notifications now use the draft's UI label, which is what the control panel shows elsewhere. It falls back to “Untitled entry” and respects entry types' UI label formats.

 SendUserReviewNotifications
   t('“{entry}” is awaiting your approval in {stage}.', [
-    'entry' => $event->draft->title,
+    'entry' => $event->draft->getUiLabel(),
   ])
   // same for approved, changes requested, commented, reset, and the email's {{ entry }}

Titled drafts are unchanged. Draft names (“Draft 1”) were never part of these messages.

Evidence

tests/Feature/Workflow/WorkflowsTest.php: names untitled drafts in review notifications

draft.title = null; submit for review
expect(reviewer notification message) == '“Untitled entry” is awaiting your approval in Review.'
  • Before: fails with '“” is awaiting your approval in Review.'
  • After: passes. tests/Feature/Workflow passes (59 tests).

Workflow notifications interpolated the draft's title, which is empty
for drafts that don't have one yet, such as new entries submitted for
review before they were titled. Use the draft's UI label instead, which
falls back to “Untitled entry” and respects UI label formats.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1b7ff-d0c0-77c2-9643-6ab03a5ec1ad
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/ui — open Storybook

No changed components detected in this Storybook.

resources/js — open Storybook

No changed components detected in this Storybook.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant